<include file="header"/>
<div class="wraper">
    <div class="check-box clearfix">
        <div class="check-list" data-type="0"><span class="iconfont icon-checkbox"></span> 退货退款<input class="refund" type="radio" name="refund" value="0" /></div>
        <div class="check-list check" data-type="1"><span class="iconfont icon-checkbox icon-xuanzedianjihou"></span> 不退货退款<input class="refund" type="radio" name="refund" value="1"  /></div>
    </div>
    <p class="form-list"><input type="text" id="refund_reason" value="" placeholder="描述退款原因"/></p>
    <div class="big-btn">
    	<input type="hidden" id="order_id" value="{BEESCRM:$order_id}">
    	<input type="hidden" id="type" value="1">
    	<input type="hidden" id="status_backup" value="{BEESCRM:$status_backup}">
        <a href="#" class="btn" id="submit">确认</a>
        <a href="#" class="btn cancel">取消</a>
    </div>
</div>
<include file="commonJs" />
<script>
    $('.check-box').on('click','.check-list',function(){
        $(this).addClass('check').siblings().removeClass('check');
        $('#type').val($(this).data('type'));
        $('.check').find('span').addClass('icon-xuanzedianjihou');
        $('.check').siblings().find('span').removeClass('icon-xuanzedianjihou');
    });
	$(function(){
		//确认付款
		$(document).on('click','#submit',function(){
			var data={};
			var store_id = {BEESCRM:$storeId};
			data.order_id=$('#order_id').val();
			data.status_backup=$('#status_backup').val();
			data.refund_type=$('#type').val();
			data.refund_reason=$('#refund_reason').val();
			data.status=5;
			var json={};
			json.url="/base/store/refundUpdate/store_id/"+store_id;
			json.method="post";
			json.data=data;
			$.getAjax(json,true,reload,'');
		});
		
		//刷新页面
		function reload(){
		    var href = "{BEESCRM::U('base/store/orderlist',array('store_id'=>$storeId,'status'=>'refund','origin'=>$origin))}";
			setTimeout("location.href="+href,3000);
		}
	});
</script>
<include file="footer" />